package user

import (
	"context"
	"large-model-platform-backend/internal/svc"
	"large-model-platform-backend/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type CreateChatSessionLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewCreateChatSessionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateChatSessionLogic {
	return &CreateChatSessionLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *CreateChatSessionLogic) CreateChatSession(req *types.ChatSessionReq) (resp *types.BooleanResp, err error) {

	userModel := l.svcCtx.UserModel

	_, err = userModel.InsertChatSession(l.ctx, req)
	var msg = ""
	if err != nil {
		msg = err.Error()
	}
	return &types.BooleanResp{
		Result: types.Result{
			Code:    200,
			Message: msg,
		},
		Data: true,
	}, nil
}
